<%--
  Created by IntelliJ IDEA.
  User: 曹圣平
  Date: 2018/10/230
  Time: 11:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
    <title>关联详情</title>
    <link rel="stylesheet" href="/css/officialDocument/officialDocument.css">
    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <link rel="stylesheet" href="/lib/pagination/style/pagination.css">
    <link rel="stylesheet" type="text/css" href="../lib/pagination/style/pagination.css"/>
    <link rel="stylesheet" href="/lib/laydate/need/laydate.css">
    <link rel="stylesheet" href="/css/base.css">
    <link rel="stylesheet" type="text/css" href="/css/base/base.css?20201106.1"/>
    <script src="/js/common/language.js"></script>
    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script src="/js/jquery/jquery.cookie.js"></script>
    <script src="/lib/layer/layer.js?20201106"></script>
    <script src="/js/base/base.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <script type="text/javascript" src="/js/base/tablePage.js"></script>
    <script src="/lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <style>
        h2{
           margin: 30px;
        }
        h3{
            margin: 50px 0 15px 30px;
            font-size: 18px;
            font-weight: normal;
        }
        .list{
            width: 98%;
            height: 216px;
            margin: 0 auto;
            margin-top: 15px;
            margin-left: 20px;
            overflow: scroll;
            overflow-x: hidden;
            /*overflow: hidden;*/
        }
        table{

        }
        table tr{
            height: 42px;
            line-height: 42px;
        }
        table tr th{
            font-size: 18px;
            font-weight: bold;
            color: #2F5C8F;
        }
        .head .title{
            margin-left: 5px;
            font-family: Microsoft yahei,Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif;
            margin-top: -3px;
            margin-right: 80px;
            font-size: 17pt;
            color: #494d59;
            line-height: 44px;
        }

    </style>
</head>
<body>
<div class="head" >
    <div class="title">
        关联详情
    </div>
</div>
<div class="tbody"></div>
</body>
<script>
    function getLists() {
        var localUrl = window.location.href;
        var flowId = null;
        if(localUrl.indexOf("?")!=-1){
            var str = localUrl.substr(1);
            var strs = str.split("&");
            strs[0].split("=")[1];
            flowId = strs[0].split("=")[1];
        }
        $.ajax({
            url:'/flowModelAssociationSet/queryFlowAssociation',
            type:'get',
            data:{
                flowId:flowId,
                type:0
            },
            dataType:'json',
            success:function(data){
//                console.log(data.obj);
                var x = data.obj;
                var status = null;
                for(var i=0;i<x.length;i++){
                    var cur = x[i];
                    $.each(cur,function (key,value) {
                        var str = '';
                        str+='<h3>'+key+'</h3>'+'<div class="list">'+'<table class="listTable">'+'<tr>'+'<th>'+"流水号"+'</th>'+' <th>'+"工作名称/文号"+'</th>'+'<th>'+"发起人"+'</th>'+'<th>'+"经办步骤(流程图)"+'</th>'+'<th>'+"状态"+'</th>'+'<th>'+"到达时间"+'</th>'+'</tr>'+'</table>'+'</div>';
                        $('.tbody').append(str);
                        var str1 = '';
                        var strx = null;
                        for(var k=0;k<value.length;k++){
                            status = value[k].prcsFlag;
                            switch (status){
                                case "1":
                                    strx = "未接收";
                                    break;
                                case "2":
                                    strx = "办理中";
                                    break;
                                case "3":
                                    strx = "转交下一步，下一步经办人无人接收";
                                    break;
                                case "4":
                                    strx = "已办结";
                                    break;
                                case "5":
                                    strx = "自由流程预设步骤";
                                    break;
                                default:
                                   strx = "已挂起"
                            }
                            str1+='<tr>'+'<td>'+value[k].flowRun.runId+'</td>'+'<td>'+key+'</td>'+'<td>'+value[k].userName+'</td>'+'<td>'+"第"+value[k].prcsId+"步:"+ value[k].flowProcess.prcsName+ '</td>'+'<td>'+strx+'</td>'+'<td>'+value[k].createTime.slice(0,9)+'</td>'+'</tr>'
                        }
                        $(".listTable").append(str1);
                    })
                }
            }
        })
    }
    getLists()
</script>
</html>